from selenium.webdriver.remote.webdriver import WebDriver

from page_object.base_page import Actions
from utils.config import by
from utils.log import logger


class Register:
    def __init__(self, driver: WebDriver, url: str) -> None:
        self.driver = driver
        self.url = url
        self._action = Actions(self.driver)

    def back_to_home(self) -> None:
        logger.info("back to home")
        self.driver.get(self.url)

    def get_title(self, locator: str, by: str = by) -> str:
        logger.info("get register title")
        return self._action.get_text(by, locator)
